<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
          integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>

    <style>
        .login {
            width: 350px;
            margin: 150px auto 0;
            border: 1px solid #cccccc;
            border-radius: 10px;
            padding: 20px;
        }

        .row {
            margin-bottom: 30px;
        }
        h2 {
            margin-bottom: 20px;
            border-bottom: 1px solid #cccccc;
            text-align: center;
            padding-bottom: 10px;
            font-size: 24px;
        }
        .error {
            margin: 10px 0;
            text-align: center;
            color: red;
        }
    </style>
</head>
<body>
<div class="login">
    <div class="login-screen">
        <h2>用户登录</h2>
        <div class="login-form">
            <div class="error">${errorMessage!}</div>
            <form action="/login" method="post">
                <div class="row">
                    <div class="col-lg-3" style="padding-right: 0px;">用户名：</div>
                    <div class="col-lg-9" style="padding-left: 0px;">
                        <input type="text" name="username" placeholder="请输入用户名" class="form-control" aria-label="...">
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-3" style="padding-right: 0px;">密码：</div>
                    <div class="col-lg-9" style="padding-left: 0px;">
                        <input type="password" name="password" placeholder="请输入密码" class="form-control" aria-label="...">
                    </div>
                </div>
                <#if needCaptcha?? && needCaptcha>
                <div class="row">
                    <div class="col-lg-3" style="padding-right: 0px;">验证码：</div>
                    <div class="col-lg-4" style="padding-left: 0px;">
                        <input type="text" name="captcha"
                               class="form-control" aria-label="...">
                    </div>
                    <div class="col-lg-4" style="padding-left: 0px;">
                        <img id="captcha" src="/captcha" height="35" width="125" onclick="refreshCaptcha()">
                    </div>
                </div>
                </#if>
                <button class="btn btn-primary btn-large btn-block" type="submit">Login</button>
            </form>
        </div>
    </div>
</div>
</body>
</html>
<script>
    function refreshCaptcha() {
        $('#captcha').attr('src', '/captcha?_rid=' + Math.random());
    }
</script>